@extends('web.layouts.app')

@section('styles')
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/index.css') }}">
    <link rel="stylesheet" type="text/css" href="{{ asset('resources/web/css/ucenter.css')}}">
@endsection

@section('content')
<div class="uc-wrap swrap mt20">
	<div class="uc-side L">
		<div class="uc-nav">
			<ul>@include('web.user_center.menu')</ul>
		</div>
	</div>
	<div class="uc-main uc-mainbg R">
		<!--还款明细菜单选项-->
		<ul class="user-main-top-tab">
			<li class="{{$find['status']==0?'active':''}}"><a href="{{ action('UserCenter\LoanerController@pendingRepayment',['menu'=>13,'status'=>0]) }}">待还款明细</a></li>
			<li class="{{$find['status']==1?'active':''}}"><a href="{{ action('UserCenter\LoanerController@pendingRepayment',['menu'=>13,'status'=>1]) }}">已还款明细</a></li>
		</ul>
		<!--借款管理查询表单-->
		<div class="user-time-search ml20">
			<form action="/loaner/pending_repayment" method="get">
				<span>起止日期</span>
				<input type="text" name="begin_time" value="{{isset($find['begin_time'])?$find['begin_time']:''}}" class="date-txt Wdate" onclick="WdatePicker();"> -
				<input type="text" name="end_time" value="{{isset($find['end_time'])?$find['end_time']:''}}" class="date-txt Wdate" onclick="WdatePicker();">
				<input type="submit" class="btn" value="搜索">
				<span class="speed-search">
					<a href="/loaner/pending_repayment?last_month=1">过去1个月</a>
					<a href="/loaner/pending_repayment?last_month=3">过去3个月</a>
					<a href="/loaner/pending_repayment?last_month=12">过去1年</a>
				</span>
			</form>
		</div>
		<!--资金项目展示-->
		<div class="user-rz-fund-items">
			<dl>
				<dt>笔数</dt>
				<dd><em>{{$list->count()}}</em></dd>
			</dl>
			<dl>
				<dt>还款金额</dt>
				<dd><em>{{number_format($list->sum('profit')+$list->sum('money'),2)}}</em>元</dd>
			</dl>
			<dl>
				<dt>本金</dt>
				<dd><em>{{number_format($list->sum('money'),2)}}</em>元</dd>
			</dl>
			<dl>
				<dt>利息</dt>
				<dd><em>{{number_format($list->sum('profit'),2)}}</em>元</dd>
			</dl>
		</div>
		<!--融资列表-->
		<div class="user-item-list">
			<ul class="data-list refund-list">
				<li class="th">
					<div class="col-name">项目名称</div>
					<div class="col-date">还款时间</div>
					<div class="col-method">还款方式</div>
					<div class="col-total">还款总金额(元)</div>
					<div class="col-capital">应还本金(元)</div>
					<div class="col-interests">应还利息(元)</div>
					<div class="col-status">状态</div>
				</li>
				@forelse($list as $item)
				<li>
					<div class="col-name name">
						<a href="/oneProjects/{{$item->project_id}}">{{$item->projects_name}}&nbsp;</a>
					</div>
					<div class="col-date">{{$item->input_time}}&nbsp;</div>
					<div class="col-method">{{$item->repayment_name}}&nbsp;</div>
					<div class="col-total">{{$item->money+$item->profit}}&nbsp;</div>
					<div class="col-capital">{{$item->money}}&nbsp;</div>
					<div class="col-interests">{{$item->profit}}&nbsp;</div>
					<div class="col-status">
						@if($item->status)
						<span class="bgreen">已还款&nbsp;</span>
						@else
						<a class="blue" href="/loaner/repayment/{{$item->id}}">还款&nbsp;</a>
						@endif
					</div>
				</li>
				@empty
				<li>无记录</li>
				@endforelse
			{{$links}}
		</div>

	</div>
</div>
@endsection

@section('scripts')
    <script src="{{ asset('resources/web/js/index.js') }}"></script>
	<script type="text/javascript" src="{{asset('resources/web/plugins/datePicker/WdatePicker.js')}}"></script>
@endsection